package com.mc.algorithm;

public class OneBit {
	
	public static int compute(int a){
		int sum = 0;
	
		while(a!=0){
			if((a&1)==1)
				sum++;
			a = a>>1;
		}
		return sum;
	}
	public static int compute2(int a){
		int sum =0;
		while(a!=0){
			if(a%2==1)
				sum++;
			a/=2;
		}
		return sum;
	}
	public static void main(String[] args) {
		int res = OneBit.compute(10);
		System.out.println(res);
	}
}
